package com.book.store.present.api;

import com.book.store.domain.store.entity.Book;
import com.book.store.present.service.BookStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/books")
public class BookApi {

    @Autowired
    private BookStoreService bookService;

    @RequestMapping("")
    private Object getbooks(){
        return bookService.getBooks();
    }

    @RequestMapping("/{id}")
    private Book getBook(@PathVariable("id") String id) {
        return bookService.getBook(id);
    }
}
